<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
 <%@page import="com.xhd.vo.Order"%>
<%@page import="java.util.Iterator"%>
<%@page import="com.xhd.vo.Fruits"%>
<%@page import="java.util.List"%>
<%@page import="com.xhd.Dao.SalerDaoImpl"%>
<%@page import="com.xhd.Dao.SalerDao"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
<head>
<title>Insert title here</title>
<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<meta http-equiv="content-type" content="text/html;charset=utf-8">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<style type="text/css">
	* {
		font-size: 11pt;
	}
	div {
		border: solid 2px rgb(78,78,78);
		width: 75px;
		height: 75px;
		text-align: center;
	}
	li {
		margin: 10px;
	}
</style>
</head>
 <body style="background: rgb(254,238,189);">
<c:if test="${ not empty sessionScope.user}">
  <h1 align="center">订单列表</h1>
<%
	SalerDao sd = new SalerDaoImpl();
	List<Order> orderlist=sd.showOrder();
	Iterator<Order> oIter=orderlist.iterator();
	Order order=null;
	%>
	<table border="1" width="100%" cellspacing="0" background="black">
	<tr bgcolor="rgb(78,78,78)" bordercolor="rgb(78,78,78)" align="center" style="color: white;">
	
			<td width="100px">买家</td>
			<td width="200px">手机号码</td>
			<td width="200px">配送地址</td>
			<td width="200px">水果</td>
			<td width="200px">订单状态</td>
			<td width="200px">订单处理</td>
	
	</tr>
	<%	
		while(oIter.hasNext()){
			order=oIter.next();
	%>
	
	<tr bordercolor="rgb(78,78,78)" align="center">
	<td><%=order.getOrder_buyer() %></td>
		<td><%=order.getOrder_phone() %></td>
		<td><%=order.getOrder_address()%></td>
		<td><%=order.getOrder_fruit()%></td>
		<td><%=order.getOrder_state() %></td>
		<td><%if (order.getOrder_state().equals("待处理")){%>
    <a href="TradingIntention.jsp?fruit=<%=order.getOrder_fruit() %>&buyer=<%=order.getOrder_buyer() %>">意向交易</a>
     <% } 
		else if (order.getOrder_state().equals("意向订单")){
     %>
    <a href="OrderSuccess.jsp?fruit=<%=order.getOrder_fruit() %>&buyer=<%=order.getOrder_buyer() %>">交易成功</a><br>
    <a href="OrderFail.jsp?fruit=<%=order.getOrder_fruit() %>&buyer=<%=order.getOrder_buyer() %>">取消交易</a>
    <%	
    }
		else if (order.getOrder_state().equals("非意向订单")){
	%>
		有关于该商品的订单未处理！
	<% 
		}
	  else{
	%>
		订单已处理
	<%	  
	  }
    %></td>
    <%}%>
	</tr>
</table>
</c:if>
<c:if test="${  empty sessionScope.user}">
<h1>你还未登录！</h1>
<a href="SalerLogin.jsp">点击登录</a>
</c:if>
  </body>
</html>